package com.base.cn.platform.os.controller.mobile.user.center.systemset;

import com.base.cn.platform.os.common.MobileBaseController;
import com.base.cn.platform.os.common.utils.result.ResultUtil;
import com.base.cn.platform.os.service.manage.user.user.CusUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Map;

/**
 * H5系统设置Controller
 *
 * @author zsw
 * @create 2018/6/15
 */
@Controller
@RequestMapping("/mobile/uc/config")
public class MobileSystemSetController extends MobileBaseController {

    @Autowired
    private CusUserService cusUserService;

    /**
     * 关于我们页面
     * @return
     */
    @RequestMapping("/toAboutPage")
    public String toAboutPage(HttpServletRequest request){
        return resultPage("/user/center/system/about");
    }

    /**
     * 保存修改是否仅在Wifi下观看
     * @param request
     * @param isWifi 0否  1是
     * @return
     */
    @RequestMapping("/setIsWifi")
    @ResponseBody
    public Map<String,Object> setIsWifi(HttpServletRequest request,
                                        @RequestParam("isWifi")Integer isWifi){
        BigDecimal userId= webMobileLoginUtil.getLoginUserId(request);
        cusUserService.updateUserNumberOfStatistics(userId,"isWifi",isWifi);
        return ResultUtil.SUCCESS("设置成功");
    }

}
